/**
 * @param {number[]} height
 * @return {number}
 */
var maxArea = function (height) {
    let pStart = 0
    let pEnd = height.length - 1
    let max = 0
    while (pStart <= pEnd) {
        let hStart = height[pStart]
        let hEnd = height[pEnd]
        let minHeight = hStart > hEnd ? hEnd : hStart
        let temp = minHeight * (pEnd - pStart)
        max = temp > max ? temp : max
        hStart > hEnd ? pEnd-- : pStart++
    }
    return max
};